Skip to main content

Choose Your Implementation

Password Generator offers three ways to generate secure passwords. Choose the one that best fits your needs:

Web Application

User-friendly interface with password management

Python Package

Programmatic integration into your applications

Console

Command-line tool for quick generation

Web Application

The web application provides a complete password management solution with authentication and cloud storage.

Generate Your First Password

1

Access the Web Application

Navigate to the Password Generator web application at https://password-generator-backend.fly.devYou’ll see the landing page with a “Generate Password” button.
2

Generate a Password

Click the Generate Password button to create a new secure password.The password will be displayed in the center of the screen. Each click generates a new unique password.
No authentication required for basic password generation. This feature is publicly accessible.
3

Copy the Password

Click the copy button next to the generated password to copy it to your clipboard.The password format includes:
  • Mixed case letters (a-z, A-Z)
  • Numbers (0-9)
  • Special characters (!@#$%^&*)

Create an Account and Save Passwords

To save and manage passwords, you need to create an account:
1

Register a New Account

Click on Sign Up in the navigation menu.Fill out the registration form:
Registration Fields
{
  "username": "your_username",
  "email": "your_email@example.com",
  "password": "your_secure_password",
  "first_name": "John",
  "last_name": "Doe"
}
Email must be unique. You’ll receive a JWT token upon successful registration.
2

Sign In

After registration, navigate to Sign In and enter your credentials.The application uses JWT (JSON Web Token) authentication for secure session management.
3

Save Generated Passwords

Once authenticated:
  1. Generate a new password
  2. Click the Save button
  3. Fill out the modal form:
    • Site Name: Name of the website/service
    • URL: Website address
    • Password: (auto-filled with generated password)
Your password is now saved to your account.
4

Manage Saved Passwords

Access your saved passwords from the navigation menu:
  • View: See all your saved passwords
  • Update: Edit site name, URL, or password
  • Delete: Remove passwords you no longer need
All saved passwords are scoped to your account. Other users cannot access your data.

Additional Features

Dark Mode

Toggle between light and dark themes using the theme button in the navigation bar

User Profile

Update your profile information, upload an avatar, or delete your account from the profile page

Python Package

Use the Password Generator as a Python library in your applications.

Installation

1

Install via pip

pip install edimez14-password-generator-1
Requires Python 3.6 or higher. No additional dependencies needed.

Basic Usage

from password_generator import password

# Generate a password with default settings
generated_password = password()
print("Generated Password:", generated_password)

# Output example: "#5aB8c7d9!"

Integration Example

Here’s how the web application integrates the password generation logic:
Django View Integration
from password_generator import password
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework import status

@api_view(['GET'])
@permission_classes([AllowAny])
def response_password(request):
    try:
        result = password()
        
        if isinstance(result, str) == False:
            return Response(
                {"Error in script": result}, 
                status=status.HTTP_500_INTERNAL_SERVER_ERROR
            )
        
        return Response(
            {"output": result}, 
            status=status.HTTP_200_OK
        )
    except Exception as e:
        return Response(
            {"error": str(e)}, 
            status=status.HTTP_500_INTERNAL_SERVER_ERROR
        )

Frontend Integration

The React frontend calls the API to retrieve generated passwords:
API Request
import axios from "axios";

const api = axios.create({
  baseURL: "https://password-generator-backend.fly.dev/api/",
});

export const getGeneratePassword = async () => {
  try {
    const response = await api.get("response-password/");
    if (response.data && response.data.output) {
      return response.data.output;
    } else {
      throw new Error("No output returned from the backend");
    }
  } catch (error) {
    console.error("Error fetching Python output:", error);
    throw error;
  }
};
React Component
"use client";
import { useState } from 'react';
import { Button } from "@nextui-org/button";
import { getGeneratePassword } from '@/app/utils/Request.api';

export default function Content() {
  const [password, setPassword] = useState("Press the button to generate a password");

  const handleOnClick = async () => {
    try {
      const newPassword = await getGeneratePassword();
      setPassword(newPassword);
    } catch (error) {
      console.error("Error getting password:", error);
    }
  };

  return (
    <main className="flex flex-col gap-2 items-center justify-center">
      <div className='flex gap-3 items-center justify-between'>
        <p className='text-2xl text-center'>{password}</p>
      </div>
      <Button onClick={handleOnClick}>
        generate password
      </Button>
    </main>
  );
}

Console Application

The console version provides the quickest way to generate a password from the command line.

Installation

1

Install the Package

pip install edimez14-password-generator-1
2

Run from Command Line

python -m password_generator
A password will be generated and displayed in your terminal.

Example Output

Terminal
$ python -m password_generator
#5aB8c7d9!
The console version uses the same core generation logic as the web application and Python package, ensuring consistent password quality across all implementations.

Understanding Password Generation

The Generation Algorithm

Each password is created through a multi-step process:
1

Initialize Character Pools

Three pools are created:
  • Numbers: Random selection from 0-4000
  • Letters: Random selection from a-z
  • Special Characters: Random selection from 36 special characters
2

Generate 50 Candidates

The algorithm creates 50 unique password candidates, each following the pattern:[special][number][lowercase][special][UPPERCASE][lowercase][number][lowercase][lowercase][special]
3

Random Selection

One password is randomly selected from the 50 candidates to return as the final result.

Password Strength

Generated passwords provide strong security through:
  • Length: 10 characters
  • Complexity: 4 character types (uppercase, lowercase, numbers, special)
  • Entropy: Multiple randomization passes
  • Uniqueness: Duplicate checking during generation
While the algorithm generates strong passwords, remember to:
  • Never reuse passwords across different sites
  • Store passwords securely (use the web app’s save feature or a password manager)
  • Enable two-factor authentication when available

Next Steps

API Reference

Explore detailed API endpoint documentation

Authentication

Learn about JWT authentication and user management

Password Management

Deep dive into CRUD operations for saved passwords

Deployment

Deploy your own instance of the web application